<template>
  <div class="main clearfix">
    <!-- 查询 -->
    <section class="section_wrap wrap_te">
      <el-form
        :inline="true"
        style="text-align: left"
        :model="query"
        ref="query"
        class="query clearfix"
      >
        <el-form-item label="关键词:" prop="keyword">
          <el-input
            placeholder="订单号、客户名称、客户手机"
            v-model="query.keyword"
          ></el-input>
        </el-form-item>
        <el-form-item label="归属公司:" prop="firmId">
          <el-select
            v-model="query.firmId"
            placeholder="请选择"
            @change="companyChange"
            popper-class="selectBox"
          >
            <el-option
              v-for="item in companyData"
              :key="item.id"
              :label="item.companyName"
              :value="item.id"
            ></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="归属部门:" prop="deptId">
          <treeselect
            class="treeSel"
            :options="deptData"
            :clearable="false"
            v-model="query.deptId"
            :normalizer="normalizer"
            @select="handleNodeClick"
            placeholder="请选择部门"
            noOptionsText="请先选择归属公司"
          />
        </el-form-item>
        <el-form-item label="归属人员:" prop="employeeId">
          <el-select v-model="query.employeeId" placeholder="请选择">
            <el-option
              v-for="item in personnelData"
              :key="item.id"
              :label="item.employeeName"
              :value="item.id"
            ></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="订单状态:" prop="orderState">
          <el-select v-model="query.orderState" placeholder="请选择">
            <el-option
              v-for="item in orderStatusData"
              :key="item.itemValue"
              :label="item.itemText"
              :value="item.itemValue"
            ></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="归属人员类型:" prop="employeeTypeId">
          <el-select v-model="query.employeeTypeId" placeholder="请选择">
            <el-option
              v-for="item in personnelTypeData"
              :key="item.itemValue"
              :label="item.itemText"
              :value="item.itemValue"
            ></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="提成核算:" prop="calculationState">
          <el-select v-model="query.calculationState" placeholder="请选择">
            <el-option
              v-for="item in calculationStateData"
              :key="item.itemValue"
              :label="item.itemText"
              :value="item.itemValue"
            ></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="由我批准:" prop="approvalByMeState">
          <el-select v-model="query.approvalByMeState" placeholder="请选择">
            <el-option
              v-for="item in approvalByMeStateData"
              :key="item.itemValue"
              :label="item.itemText"
              :value="item.itemValue"
            ></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="更新提醒:" prop="markUpdate">
          <el-select v-model="query.markUpdate" placeholder="请选择">
            <el-option
              v-for="item in markUpdateData"
              :key="item.itemValue"
              :label="item.itemText"
              :value="item.itemValue"
            ></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="录入日期:" prop="grantTime">
          <el-date-picker
            v-model="query.grantTime"
            :default-time="['00:00:00', '23:59:59']"
            type="daterange"
            range-separator="至"
            start-placeholder="开始日期"
            end-placeholder="结束日期"
            style="width: 210px"
            @change="timeChange"
          >
          </el-date-picker>
        </el-form-item>
        <el-form-item label="收费状态:" prop="chargeStatus">
          <el-select v-model="query.chargeStatus" placeholder="请选择">
            <el-option
              v-for="item in chargeStatus"
              :key="item.itemValue"
              :label="item.itemText"
              :value="item.itemValue"
            ></el-option>
          </el-select>
        </el-form-item>
        <el-form-item
          label="应还月份:"
          prop="answerMonth"
          v-if="
            prductId == 3 || prductId == 11 || prductId == 10 || prductId == 13
          "
        >
          <el-date-picker
            v-model="answerMonth"
            type="date"
            placeholder="应还月份"
            value-format="yyyy-MM-dd"
          >
          </el-date-picker>
        </el-form-item>
        <el-form-item label="倒计时:" prop="countdownDay">
          <el-select
            v-model="query.countdownDay"
            placeholder="请选择"
          >
            <el-option
              v-for="item in countdownList"
              :key="item.id"
              :label="item.description"
              :value="item.itemValue"
            ></el-option>
          </el-select>
        </el-form-item>
        <el-form-item class="button">
          <el-button v-no-more-click type="danger" @click="emptyFun"
          >清空
          </el-button
          >
          <el-button v-no-more-click type="primary" @click="queryFun"
          >搜索
          </el-button
          >
        </el-form-item>
      </el-form>
    </section>
    <section class="section_wrap">
      <el-form>
        <el-row>
          <el-col :xl="24">
            <el-form-item class="btn">
              <el-button @click="orderExport" v-if="showExporBtn"
              >+导出
              </el-button
              >
              <el-button @click="newSingLe" v-if="showNewSingLe"
              >+录入新单
              </el-button
              >
              <!-- <el-button @click="orderExportToBe" v-if="showWaitingOrder"
                >+导出待交件</el-button
              > -->
              <!-- <el-button @click="orderExportToWaite" v-if="showWaitingLoanOrder"
                >+导出待放款表</el-button
              > -->
              <!-- <el-button
                @click="putUpdateStatus(2, 3)"
                v-if="showUpdateStatusList"
                >+标记已交件</el-button
              > -->
              <el-button @click="ExportingUserInfo" v-if="userInfoExport"
              >+导出客户信息表
              </el-button
              >
              <!-- <el-button
                @click="ExportLoanInfo"
                v-if="
                  prductId == 3 ||
                  prductId == 11 ||
                  prductId == 10 ||
                  prductId == 13
                "
                >+导出贷后数据表</el-button
              > -->
              <el-button
                @click="ExportLoanInfo"
                v-if="
                  (prductId == 3 && loanInfoExport && environment=='production') ||
                  (prductId == 13 && loanInfoExport && environment=='production') ||  (prductId == 15 && loanInfoExport && environment=='development')
                "
              >+导出贷后数据表
              </el-button
              >
              <!-- <el-button @click="putUpdateStatus(3, 4)">+标记已放款</el-button> -->
              <!-- <el-button
                @click="putUpdateStatus(4, 5)"
                v-if="showReturnedStatusList"
                >+标记已归档</el-button
              > -->
              <span
                v-if="showNewNum"
                style="float: right; line-height: 18px; margin-top: 10px"
              >您有<b
              ><el-badge :value="newNum" :max="99" class="item">
                  </el-badge></b
              >条未做处理</span
              >
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>

      <el-table
        :data="tableData"
        :inline="true"
        border
        stripe
        style="width: 100%"
        :row-key="getRowKey"
        ref="multipleTable"
        @selection-change="changeFun"
      >
        <el-table-column
          type="selection"
          :reserve-selection="true"
          width="36"
          class-name="checkBox"
        ></el-table-column>
        <el-table-column
          prop="orderNumber"
          label="业务单号"
          :show-overflow-tooltip="true"
        />
        <el-table-column
          v-if="
            prductId == 3 ||
            prductId == 10 ||
            prductId == 12 ||
            prductId == 15 ||
            prductId == 13
          "
          prop="fileCoding"
          label="档案编码"
          :show-overflow-tooltip="true"
        />
        <el-table-column
          prop="borrowerName"
          label="客户名称"
          :show-overflow-tooltip="true"
        >
          <template slot-scope="{row}">
            <i v-if="row.countdownDay!=null && row.countdownDay<=180" class="el-icon-warning"></i>
            <span>{{ row.borrowerName }}</span>
          </template>
        </el-table-column>
        <el-table-column
          prop="address"
          label="客户地区"
          :show-overflow-tooltip="true"
        />
        <el-table-column
          prop="orderMoney"
          label="审批金额(万元)"
          :show-overflow-tooltip="true"
        />
        <el-table-column
          prop="contractGuaranteeMonth"
          label="期限"
          :show-overflow-tooltip="true"
        />
        <el-table-column
          prop="belongCompany"
          label="归属公司"
          :show-overflow-tooltip="true"
        />
        <el-table-column
          prop="belongDepartment"
          label="归属部门"
          :show-overflow-tooltip="true"
        />
        <el-table-column
          prop="belongEmployee"
          label="归属人员"
          :show-overflow-tooltip="true"
        />
        <el-table-column
          prop="belongType"
          label="归属人员类型"
          :formatter="translaPersonnel"
          :show-overflow-tooltip="true"
        />
        <el-table-column
          prop="inputTime"
          label="录入日期"
          :show-overflow-tooltip="true"
        />
        <el-table-column
          prop="inputName"
          label="录入人"
          :show-overflow-tooltip="true"
        />
        <el-table-column
          prop="channelName"
          label="推广员"
          :show-overflow-tooltip="true"
        />
        <el-table-column
          prop="calculationState"
          label="提成核算"
          :formatter="translaCalculation"
          :show-overflow-tooltip="true"
        />
        <el-table-column
          prop="approveName"
          label="审批进展"
          :show-overflow-tooltip="true"
        />
        <el-table-column
          prop="approvalByMeState"
          label="由我审批"
          label-class-name="tips"
          :formatter="translaApprovalByMe"
          :show-overflow-tooltip="true"
        >
        </el-table-column>
        <el-table-column
          prop="updateTime"
          label="更新日期"
          :show-overflow-tooltip="true"
        />
        <el-table-column
          prop="markUpdate"
          label="更新提醒"
          :formatter="translaMarkUpdate"
          :show-overflow-tooltip="true"
        />
        <el-table-column
          prop="orderStatus"
          label="订单状态"
          :formatter="translaOrderStatus"
          :show-overflow-tooltip="true"
        >
<!--          <template slot-scope="{row}">-->
<!--            <span  v-if="row.orderStatus==13 && !row.orderMoney">审批中</span>-->
<!--            <span v-else>{{translaOrderStatus}}</span>-->

<!--          </template>-->

<!--          <el-table-column-->
<!--            v-else-->
<!--            prop="orderStatus"-->
<!--            label="订单状态"-->
<!--            :formatter="translaOrderStatus"-->
<!--            :show-overflow-tooltip="true"-->
<!--          />-->
        </el-table-column>

        <el-table-column prop="chargeStatusName" label="财务收费" />
        <el-table-column prop="countdownDay" label="倒计时">
          <template slot-scope="{row}" v-if="row.countdownDay!=null">
            <span>剩余{{ row.countdownDay }}天</span>
          </template>
        </el-table-column>
        <el-table-column fixed="right" label="操作" width="100">
          <template slot-scope="scope">
            <template
              v-if="(isContract==4 &&  showViewBtnDBAJF) || (isContract==0 &&  showViewBtnAJF) || (isContract==1 &&  showViewBtnLYB)">
              <!-- 已录入! -->
              <el-button
                type="text"
                size="small"
                v-if="scope.row.orderStatus == 0 && showHasBeenRecorded"
                @click="HasBeen(scope.row)"
                style="color: #45b8ef"
              >查看
              </el-button
              >
              <!-- 审批中! -->
              <el-button
                type="text"
                size="small"
                v-if="scope.row.orderStatus == 1 && showExaminationBtn"
                @click="Examination(scope.row)"
                style="color: #8858ac"
              >查看
              </el-button
              >
              <!-- 待交件! -->
              <el-button
                type="text"
                size="small"
                v-if="scope.row.orderStatus == 2 && showToSubmitBtn"
                @click="ToSubmit(scope.row)"
                style="color: #ffa42f"
              >查看
              </el-button
              >
              <!-- 待放款! -->
              <el-button
                type="text"
                size="small"
                v-if="(scope.row.orderStatus == 3 ||  scope.row.orderStatus == 13 ||  scope.row.orderStatus == 14) && showToBeLentBtn"
                @click="ToBeLent(scope.row)"
                style="color: #ffa42f"
              >查看
              </el-button
              >
              <!-- 已放款=4! || 已结清=12 -->
              <el-button
                type="text"
                size="small"
                v-if="(scope.row.orderStatus == 4 || scope.row.orderStatus == 12) && showReleaseddBtn"
                @click="Released(scope.row)"
                style="color: #ffa42f"
              >查看
              </el-button
              >
              <!-- 已回款! -->
              <el-button
                type="text"
                size="small"
                v-if="scope.row.orderStatus == 5 && showTerminatedBtn"
                @click="Terminated(scope.row)"
              >查看
              </el-button
              >
              <!-- 已终止! -->
              <el-button
                type="text"
                size="small"
                v-if="scope.row.orderStatus == 6 && showTerminatedBtn"
                @click="Terminated(scope.row)"
                style="color: #fb575e"
              >查看
              </el-button
              >
              <el-button
                type="text"
                size="small"
                v-if="scope.row.orderStatus == 7 && showToBeLentBtn"
                @click="ToBeLent(scope.row)"
              >查看
              </el-button
              >
              <el-button
                type="text"
                size="small"
                v-if="scope.row.orderStatus == 11"
                @click="toFollow(scope.row)"
              >查看
              </el-button
              >
            </template>

            <span
              v-if="((isContract==4 &&  showAbortBtnDBAJF) || (isContract==0 &&  showAbortBtnAJF) || (isContract==1 &&  showAbortBtnLYB) ) && scope.row.orderStatus !== 5">
              <el-button
                @click="suspendFun(scope.row)"
                v-if="scope.row.orderStatus !== 6 && showOrderDeteBtn"
                type="text"
                size="small"
                style="color: #fb575e"
              >中止</el-button
              >
            </span>
            <el-button
              v-if="(isContract==4 &&  showAddressBtnDBAJF) || (isContract==0 &&  showAddressBtnAJF) || (isContract==1 &&  showAddressBtnLYB)"
              type="text" size="small" @click="district(scope.row)"
            >添加地址
            </el-button
            >

            <el-button
              v-if="((isContract==4 &&  showContractTempBtnDBAJF) || (isContract==1 &&  showContractTempBtnLYB)) && scope.row.isContract != 0"
              type="text"
              size="small"
              @click="cheackFun(scope.row)"
            >合同模板下载
            </el-button
            >
            <el-button
              v-if="(isContract==4 &&  showAssignBtnDBAJF) || (isContract==0 &&  showAssignBtnAJF) || (isContract==1 &&  showAssignBtnLYB)"
              type="text" size="small" @click="assigned(scope.row)"
            >指派
            </el-button>
          </template>
        </el-table-column>
        <el-table-column
          fixed="right"
          v-if="((isContract==4 && showBdcBtnDBAJF) || (isContract==1 && showBdcBtnLYB) )&& isBdc == 1"
          label="不动产"
          width="100"
        >
          <template slot-scope="scope">
            <el-button
              v-if="scope.row.xhId == null"
              type="text"
              size="small"
              @click="isBdcFun(scope.row)"
            >添加到不动产
            </el-button
            >
            <el-button
              v-if="scope.row.xhId != null"
              type="text"
              size="small"
              @click="lookBdcFun(scope.row)"
            >查看不动产
            </el-button
            >
          </template>
        </el-table-column>
      </el-table>
      <!--    分页-->
      <div class="pagination">
        <span class="title">小计：共{{ this.total }}条数据</span>
        <el-pagination
          background
          layout="prev, pager, next, sizes"
          :total="total"
          :page-size="query.pagesize"
          :page-sizes="[10, 20, 30, 40, 50]"
          :current-page.sync="currentPage"
          @current-change="handleCurrentChange"
          @size-change="handleSizeChange"
        ></el-pagination>
      </div>
    </section>
    <el-dialog
      title="中止订单"
      @close="beforeClose"
      :visible.sync="dialogsuspendFun"
      width="30%"
    >
      <el-form
        :model="suspend"
        :rules="rules"
        ref="suspendForm"
        label-width="120px"
      >
        <el-form-item label="订单号:" style="text-align: left">{{
            suspend.orderNumber
          }}
        </el-form-item>
        <el-form-item label="客户姓名：" style="text-align: left">{{
            suspendInf.name
          }}
        </el-form-item>
        <el-form-item label="描述信息：" prop="operationCause">
          <el-input type="textarea" v-model="suspend.operationCause"></el-input>
        </el-form-item>
      </el-form>
      <span slot="footer" class="dialog-footer">
        <el-button @click="dialogsuspendFun = false">取 消</el-button>
        <el-button type="primary" @click="submitsuspendFun">确 定</el-button>
      </span>
    </el-dialog>
    <el-dialog
      title="地址"
      :before-close="districtBeforeClose"
      :visible.sync="districtDialog"
      v-if="districtDialog"
      width="50%"
    >
      <DistrictDia
        :orderNumber="orderNumber"
        ref="DistrictRef"
        @closeDia="closeDia"
      ></DistrictDia>
    </el-dialog>
    <!-- 提交不动产弹框 -->
    <el-dialog
      title="填写信息"
      :visible.sync="dialogVisibleBdc"
      width="1000px"
      :before-close="handleClose"
      v-if="dialogVisibleBdc"
    >
      <BdcDialog
        :orderNumber="orderNumber"
        :isBdc="isBdc"
        ref="BdcDialog"
        @dialogCloes="dialogCloes"
      ></BdcDialog>
    </el-dialog>
    <!-- 查看不动产 -->
    <el-dialog
      title="查看信息"
      :visible.sync="dialogVisibleLookBdc"
      width="1000px"
      v-if="dialogVisibleLookBdc"
    >
      <BdcLookDialog :xhId="xhId"></BdcLookDialog>
    </el-dialog>
    <!-- 合同模板下载 -->
    <el-dialog
      title="信息核对"
      :visible.sync="dialogVisiblecheak"
      :before-close="handleCloseCheck"
      v-if="dialogVisiblecheak"
      width="1000px"
    >
      <!-- 担保合同模块下载! -->
      <!-- <CheckDia
        :bdcFDBZ="bdcFDBZ"
        :bdcFDBH="bdcFDBH"
        :bdcDBZ="bdcDBZ"
        :bdcDBH="bdcDBH"
        :bdcZ="bdcZ"
        :bdcH="bdcH"
        :orderData="orderData"
        v-if="productType == 1"
        :showForm="showForm"
        :isContract="isContract"
        ref="CheckDia"
      ></CheckDia> -->
      <!-- 保理合同下载,保理签字页下载,担保合同模块下载! -->
      <CheckDownLoad
        :bdcFDBZ="bdcFDBZ"
        :bdcFDBH="bdcFDBH"
        :bdcDBZ="bdcDBZ"
        :bdcDBH="bdcDBH"
        :bdcZ="bdcZ"
        :bdcH="bdcH"
        :orderData="orderData"
        :borrowerName="borrowerName"
        v-if="productType == 4 || productType == 1"
        :showForm="showForm"
        :isContract="isContract"
        ref="CheckDia"
      ></CheckDownLoad>
    </el-dialog>
    <!-- 指派弹窗! -->
    <el-dialog
      :modal-append-to-body="false"
      title="指派订单"
      :visible.sync="isOrder"
      width="30%"
    >
      <el-form label-width="180px">
        <el-form-item label="指派公司" prop="company">
          <el-select
            v-model="tbQuickApplyVo.company"
            clearable
            placeholder="请选择"
            @change="ace"
          >
            <el-option
              v-for="item in BelongsCompany"
              :key="item.id"
              :label="item.companyName"
              :value="item.id"
            >
            </el-option>
          </el-select>
        </el-form-item>

        <el-form-item label="指派部门" prop="departmentID">
          <el-select
            clearable
            placeholder="请选择"
            v-model="tbQuickApplyVo.departmentID"
            @change="AEC"
          >
            <el-option
              v-for="item in department"
              :key="item.id"
              :label="item.label"
              :value="item.id"
            >
            </el-option>
          </el-select>
        </el-form-item>

        <el-form-item label="归属人员">
          <el-select
            clearable
            placeholder="请选择"
            filterable
            v-model="tbQuickApplyVo.trustee"
            @change="belongData"
          >
            <el-option
              v-for="item in personnelArray"
              :key="item.id"
              :label="item.employeeName"
              :value="item.id"
            >
            </el-option>
          </el-select>
        </el-form-item>
      </el-form>
      <span slot="footer" class="dialog-footer">
        <el-button @click="isOrder = false">取 消</el-button>
        <el-button type="primary" @click="assignedButton">确 定</el-button>
      </span>
    </el-dialog>
  </div>
</template>

<script>
import { mapState, mapMutations } from "vuex";
import DistrictDia from "../../components/district/DistrictDia";
import BdcDialog from "../../components/business/BdcDialog";
import BdcLookDialog from "../../components/business/BdcLookDialog";
// import CheckDia from "../../components/InformationCheck/Check";
import CheckDownLoad from "../../components/InformationCheck/CheckDownLoad";

import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
import {
  getEmployee,
  pagelist,
  getDepartment,
  postCompanyEmployList,
  delOrder,
  getOrderListBy,
  updateStatusList,
  getTbleadgUrl,
  getProductOne,
  getFindForm,
  getBusinessDepartment,
  getCompanyList,
  departAdd,
  assignedApi, getPermType
  //UserInfoExport, //客户信息导出!
} from "../../../src/assets/js/api";
import { expotOut, checkPermiss, GMTToStr } from "../../assets/js/utlis";
import Mixin from "../../views/mixin/routeMixin";

export default {
  name: "ValueAdded",
  components: {
    Treeselect,
    DistrictDia,
    BdcDialog,
    BdcLookDialog,
    // CheckDia,
    CheckDownLoad
  },
  mixins: [Mixin],

  data() {
    return {
      normalizer(node) {
        //去掉children=[]的children属性
        if (node.children == null) {
          delete node.children;
        }
      },
      orderData: "",
      describe: {
        describe: ""
      },
      tbQuickApplyVo: {
        company: "", //指派公司ID,
        departmentID: "", //指派部门ID,
        trustee: "", //指派人员ID!
        id: "" //订单ID!
      },

      BelongsCompany: [], //所属公司!
      department: [], //所属部门!
      personnelArray: [], //归属人员!
      borrowerName: null, //这条数据的客户名字!
      productType: null, //产品类型!
      total: null,
      pageNo: 1,
      pages: 0,
      pagesize: 10,
      currentPage: 1,
      query: {
        pageNo: 1,
        keyword: null,
        firmId: null,
        deptId: null,
        employeeId: null,
        employeeTypeId: null,
        calculationState: null,
        approvalByMeState: null,
        markUpdate: null,
        orderState: null,
        prductId: "",
        grantTime: null,
        countdownDay: ""//倒计时
      },
      countdownList: [],
      answerMonth: null,
      valQuerryBy: {
        prductId: "",
        approvalByMeState: 1
      },
      newNum: "",
      queryVux: {},
      queryData: {},
      suspend: {
        orderNumber: "",
        operationCause: ""
      },
      suspendInf: {
        name: null
      },
      isOrder: false,
      dialogsuspendFun: false,
      //导出需要传的参数
      fileParmas: {
        keyword: null,
        firmId: null,
        deptId: null,
        employeeId: null,
        employeeTypeId: null,
        calculationState: null,
        approvalByMeState: null,
        markUpdate: null,
        orderState: null,
        prductId: ""
      },
      queryPersonnel: {
        firmId: null,
        deptId: null
      },
      options: [],
      tableData: [],
      // 订单状态
      orderStatusData: [],
      // 人员类型
      personnelTypeData: [],
      // 是否由我审批
      approvalByMeStateData: [],
      //财务收费状态
      chargeStatus: [],
      // 更新提醒
      markUpdateData: [],
      // 提成核算状态
      calculationStateData: [],
      // 公司数据
      companyData: [],
      // 部门数据
      deptData: [],
      // 人员数据
      personnelData: [],
      ids: [],
      orderExportId: [],
      newsOrderStatus: -2,
      golbalPermissions: [],
      //待放款跳转路径
      tbleadgUrl: "",
      //归档路径
      lendgUrl: "",
      rules: {
        operationCause: [
          { required: true, message: "请填写中止原因", trigger: "blur" }
        ]
      },
      multipleSelection: [],
      select_order_number: "",
      select_orderId: [],
      districtDialog: false,
      orderNumber: "",
      isBdc: "",
      dialogVisibleBdc: false,
      xhId: "",
      dialogVisibleLookBdc: false,
      isContract: "",
      dialogVisiblecheak: false,
      showForm: {},
      bdcZ: null, //不动产（新华普惠·重庆银行)多少字!
      bdcH: null, //不动产（新华普惠·重庆银行)多少号!
      bdcDBZ: null, //不动产担保字!
      bdcDBH: null, //不动产担保号!
      bdcFDBZ: null, //不动产反担保字!
      bdcFDBH: null, //不动产反担保号!
      environment: ""//环境   development--开发环境   production--生产环境
    };

  },

  created() {
    this.environment = process.env.NODE_ENV;

    this.query.prductId = sessionStorage.getItem("prductId");
    this.valQuerry.prductId = sessionStorage.getItem("prductId");
    this.valQuerryBy.prductId = sessionStorage.getItem("prductId");
    this.golbalPermissions = localStorage.getItem("permissions").split(",");
    this.getOrderList();
    this.orderStatus();
    this.personnelType();
    this.approvalByMeState();
    this.markUpdate();
    this.calculationState();
    this.companylist();
    this.getProduct();
    this.getcountdownList();
  },
  computed: {
    //添加地址按钮控制乐业保
    showAddressBtnLYB() {
      return checkPermiss("business:order:upDistrict:LYB", this.golbalPermissions);
    },
    //合同模板按钮控制乐业保
    showContractTempBtnLYB() {
      return checkPermiss("business:download:contract:LYB", this.golbalPermissions);
    },
    //指派按钮控制乐业保
    showAssignBtnLYB() {
      return checkPermiss("business:order:trustee:LYB", this.golbalPermissions);
    },
    //中止按钮控制乐业保
    showAbortBtnLYB() {
      return checkPermiss("business:order:delete:LYB", this.golbalPermissions);
    },
    //查看按钮控制乐业保
    showViewBtnLYB() {
      return checkPermiss("business:TbLeading:findLendingUrl:LYB", this.golbalPermissions);
    },
    //不动产按钮控制乐业保
    showBdcBtnLYB() {
      return checkPermiss("business:xhph:add:LYB", this.golbalPermissions);
    },
    //添加地址按钮控制安居分
    showAddressBtnAJF() {
      return checkPermiss("business:order:upDistrict:AJF", this.golbalPermissions);
    },
    //指派按钮控制安居分
    showAssignBtnAJF() {
      return checkPermiss("business:order:trustee:AJF", this.golbalPermissions);
    },
    //中止按钮控制安居分
    showAbortBtnAJF() {
      return checkPermiss("business:order:delete:AJF", this.golbalPermissions);
    },
    //查看按钮控制安居分
    showViewBtnAJF() {
      return checkPermiss("business:TbLeading:findLendingUrl:AJF", this.golbalPermissions);
    },
    //添加地址按钮控制担保安居分
    showAddressBtnDBAJF() {
      return checkPermiss("business:order:upDistrict:DBAJF", this.golbalPermissions);
    },
    //合同模板按钮控制担保安居分
    showContractTempBtnDBAJF() {
      return checkPermiss("business:download:contract:DBAJF", this.golbalPermissions);
    },
    //指派按钮控制担保安居分
    showAssignBtnDBAJF() {
      return checkPermiss("business:order:trustee:DBAJF", this.golbalPermissions);
    },
    //中止按钮控制担保安居分
    showAbortBtnDBAJF() {
      return checkPermiss("business:order:delete:DBAJF", this.golbalPermissions);
    },
    //查看按钮控制担保安居分
    showViewBtnDBAJF() {
      return checkPermiss("business:TbLeading:findLendingUrl:DBAJF", this.golbalPermissions);
    },
    //不动产按钮控制
    showBdcBtnDBAJF() {
      return checkPermiss("business:xhph:add:DBAJF", this.golbalPermissions);
    },
    //未处理时是0隐藏
    showNewNum: function() {
      if (this.newNum == 0) {
        return false;
      } else {
        return true;
      }
    },
    //从vueX获取数据
    ...mapState({
      valQuerry: "valueAdd"
    }),
    //导出订单按钮
    showExporBtn: function() {
      return checkPermiss("business:order:exportOrder", this.golbalPermissions);
    },
    //录入新单按钮
    showNewSingLe: function() {
      return checkPermiss("index:NewSingleEntry", this.golbalPermissions);
    },
    //标记已交件按钮
    showUpdateStatusList: function() {
      return checkPermiss(
        "business:order:updateStatusList",
        this.golbalPermissions
      );
    },
    //标记已归档按钮
    showReturnedStatusList: function() {
      return checkPermiss(
        "business:order:returnedStatusList",
        this.golbalPermissions
      );
    },
    //导出待交件按钮
    showWaitingOrder: function() {
      return checkPermiss(
        "business:order:waitingOrder",
        this.golbalPermissions
      );
    },
    //导出待放款按钮
    showWaitingLoanOrder: function() {
      return checkPermiss(
        "business:order:waitingLoanOrder",
        this.golbalPermissions
      );
    },
    //订单中止按钮
    showOrderDeteBtn: function() {
      return checkPermiss("business:order:delete", this.golbalPermissions);
    },
    //已录入按钮
    showHasBeenRecorded: function() {
      return checkPermiss("index:HasBeenRecorded", this.golbalPermissions);
    },
    //审批中按钮
    showExaminationBtn: function() {
      return checkPermiss("index:Examination", this.golbalPermissions);
    },
    //待交件按钮
    showToSubmitBtn: function() {
      return checkPermiss("index:ToSubmit", this.golbalPermissions);
    },
    //待放款按钮
    showToBeLentBtn: function() {
      return checkPermiss("index:ToBeLent", this.golbalPermissions);
    },
    //已中止按钮(含已归档)
    showTerminatedBtn: function() {
      return checkPermiss("index:Terminated", this.golbalPermissions);
    },
    //已放款按钮
    showReleaseddBtn: function() {
      return checkPermiss("index:Released", this.golbalPermissions);
    },
    // 导出贷后信息表!
    loanInfoExport: function() {
      return checkPermiss(
        "business:order:export:loanData",
        this.golbalPermissions
      );
    },
    //导出客户信息按钮!
    userInfoExport: function() {
      return checkPermiss(
        "business:order:export:customerInfo",
        this.golbalPermissions
      );
    }
  },
  methods: {
    //获取倒计时天数筛选
    getcountdownList() {
      getPermType("countdown_day").then(res => {
        this.countdownList = res.data;
      });
    },
    // 查询产品
    getProduct() {
      getProductOne(this.query.prductId).then((res) => {
        this.isContract = res.data.isContract;
        this.isBdc = res.data.isBdc;
      });
    },
    isBdcFun(row) {
      this.dialogVisibleBdc = true;
      this.orderNumber = row.orderNumber;
    },
    lookBdcFun(row) {
      this.dialogVisibleLookBdc = true;
      this.xhId = row.xhId;
    },
    handleClose(done) {
      this.$confirm("确认关闭？")
        .then(() => {
          done();
          // this.$refs.ruleForm.resetFields();
          this.$refs.BdcDialog.closeFun(true);
        })
        .catch(() => {
        });
    },
    dialogCloes() {
      this.dialogVisibleBdc = false;
    },
    // 添加地址省市区
    district(row) {
      this.orderNumber = row.orderNumber;
      this.districtDialog = true;
    },
    closeDia(data) {
      if (data == false) {
        this.districtDialog = false;
      }
    },
    //根据产品id获取跳转路径
    getTbleadgUrl(Id) {
      return new Promise((resolve) => {
        //你的逻辑代码
        getTbleadgUrl({ orderNumber: Id }).then((res) => {
          if (res.code == 200) {
            resolve(res);
          }
        });
      });
    },
    //导出订单
    orderExport() {
      this.fileParmas.keyWord = this.query.keyWord;
      this.fileParmas.employeeId = this.query.employeeId;
      this.fileParmas.employeeTypeId = this.query.employeeTypeId;
      this.fileParmas.calculationState = this.query.calculationState;
      this.fileParmas.approvalByMeState = this.query.approvalByMeState;
      this.fileParmas.markUpdate = this.query.markUpdate;
      this.fileParmas.orderState = this.query.orderState;
      this.fileParmas.firmId = this.query.firmId;
      this.fileParmas.deptId = this.query.deptId;
      this.fileParmas.prductId = this.query.prductId;
      if (this.orderExportId) {
        this.fileParmas.idList = this.orderExportId;
      } else {
        this.fileParmas.idList = null;
      }
      expotOut(
        "post",
        "/business/order/exportOrder",
        this.fileParmas, // 导出请求参数
        "增值贷产品" // 导出文件名字
      );
    },
    //导出待交件
    orderExportToBe() {
      this.query.prductId = sessionStorage.getItem("prductId");
      let fileParmas = {
        orderState: 2,
        prductId: this.query.prductId
      };
      expotOut(
        "post",
        "/business/order/exportOrder",
        fileParmas, // 导出请求参数
        "增值贷产品" // 导出文件名字
      );
    },
    //导出待放款
    orderExportToWaite() {
      this.query.prductId = sessionStorage.getItem("prductId");

      let fileParmas = {
        orderState: 3,
        prductId: this.query.prductId
      };
      expotOut(
        "post",
        "/business/order/exportOrder",
        fileParmas, // 导出请求参数
        "待放款文件" // 导出文件名字
      );
    },
    //时间input框叉叉按钮清除内容
    timeChange(value) {
      if (value == null) {
        this.query.grantTime = null;
      }
    },
    //获取用户搜索条件
    getUserSearch() {
      this.queryData = JSON.parse(JSON.stringify(this.query));
      this.queryData.pageNo = 1;
      this.queryData.prductId = sessionStorage.getItem("prductId");
      //录入日期
      if (this.queryData.grantTime && this.queryData.grantTime[0]) {
        this.queryData.grantTime[0] = GMTToStr(this.queryData.grantTime[0]);
        this.queryData.grantTime[1] = GMTToStr(this.queryData.grantTime[1]);
        this.queryData.inputMin = this.queryData.grantTime[0];
        this.queryData.inputMax = this.queryData.grantTime[1];
      }
    },
    // 导出客户信息!
    ExportingUserInfo() {
      this.getUserSearch();
      var DataList = this.queryData;
      expotOut(
        "post",
        "/business/order/export/customerInfo",
        DataList,
        "客户信息"
      );

      this.query.approvalByMeState = null;
    },
    //导出贷后信息表!
    ExportLoanInfo() {
      this.getUserSearch();
      var DataList = this.queryData;
      expotOut(
        "post",
        "/business/order/export/loanData",
        DataList,
        "贷后信息表"
      );

      this.query.approvalByMeState = null;
    },
    //模糊查询
    getOrderListBy(obj) {
      getOrderListBy(obj).then((res) => {
        this.tableData = res.data.records;
        this.pagesize = res.data.size;
        this.pageNo = res.data.current;
        this.total = res.data.total;
        this.pages = res.data.pages;
      });
    },
    // 合同模板下载
    cheackFun(row) {
      // console.log('---',row);
      this.orderData = row.orderNumber;
      this.productType = row.isContract;

      this.borrowerName = row.borrowerName; //这条数据的客户名字!

      getFindForm({ orderNumber: row.orderNumber }).then((res) => {
        if (res.code == 200) {
          this.bdcZ = "";
          this.bdcH = "";
          this.bdcDBZ = "";
          this.bdcDBH = "";
          this.bdcFDBZ = "";
          this.bdcFDBH = "";
          if (res.data.contractEntrustGuaranteeNumber) {
            var bdc = res.data.contractEntrustGuaranteeNumber;
            // console.log("bdc",bdc);
            bdc = bdc.split("）");
            // console.log("bdc1",bdc);
            bdc = bdc[1];
            // console.log("bdc2",bdc);
            bdc = bdc.split("字");
            // console.log("bdc3",bdc);
            this.bdcZ = bdc[0];

            var bdcH = bdc[1].split("号");

            this.bdcH = bdcH[0];
          }
          if (res.data.contractReversePledgeNumber) {
            var bdcDB = res.data.contractReversePledgeNumber;
            bdcDB = bdcDB.split("）");
            bdcDB = bdcDB[1];
            bdcDB = bdcDB.split("字");
            this.bdcDBZ = bdcDB[0];
            var bdcDBH = bdcDB[1].split("号");
            this.bdcDBH = bdcDBH[0];
          }
          if (res.data.contractReverseGuaranteeNumber) {
            var bdcFDB = res.data.contractReverseGuaranteeNumber;
            // var bdcFDB = "不动产（新华普惠·重庆银行）反担保2022字第263号";
            // console.log("担保安居分")
            bdcFDB = bdcFDB.split("保");
            bdcFDB = bdcFDB[1];
            if (bdcFDB.indexOf("字第") > -1) {
              bdcFDB = bdcFDB.split("字第");
            } else {
              bdcFDB = bdcFDB.split("字");
            }

            // bdcFDB = bdcFDB.split("字第");
            this.bdcFDBZ = bdcFDB[0];
            var bdcFDBH = bdcFDB[1].split("号");
            this.bdcFDBH = bdcFDBH[0];
          }
          // console.log("担保安居分")
          this.showForm = res.data;
          this.isContract = row.isContract;
          this.dialogVisiblecheak = true;
        }
      });
    },
    // 操作/指派!
    async assigned(e) {
      this.tbQuickApplyVo.company = ""; //所在公司id!
      this.tbQuickApplyVo.departmentID = ""; //所在部门id!
      this.tbQuickApplyVo.trustee = ""; //指派人员id!
      this.tbQuickApplyVo.id = e.orderId;
      this.isOrder = true;
      if (e.trustee == null) {
        //获取所在公司!
        getCompanyList().then((res) => {
          this.BelongsCompany = res.data;
        });
      } else {
        //获取所在公司!
        getCompanyList().then((res) => {
          this.BelongsCompany = res.data;
        });
        await getBusinessDepartment(e.trustee).then((res) => {
          this.tbQuickApplyVo.company = res.data.cid; //所在公司id!
          this.tbQuickApplyVo.departmentID = res.data.did; //所在部门id!
          this.tbQuickApplyVo.trustee = res.data.eid; //指派人员id!
        });
        //查询该公司归属部门!
        departAdd(this.tbQuickApplyVo.company).then((res) => {
          this.department = res.data;
        });
        // 查询归属人员!
        postCompanyEmployList(this.tbQuickApplyVo.belongId).then((res) => {
          this.personnelArray = res.data;
        });
      }
    },
    //查询指派部门!
    ace(e) {
      //查询指派公司指派部门!
      this.tbQuickApplyVo.company = e;
      departAdd(e).then((res) => {
        this.department = res.data;
      });
    },
    //查询指派人员!
    AEC(e) {
      this.departmentID = e; //所选部门ID!
      postCompanyEmployList(e).then((res) => {
        this.personnelArray = res.data;
      });
    },
    // 指派里面的确定按钮!
    assignedButton() {
      assignedApi(this.tbQuickApplyVo).then((res) => {
        var msg = res.message;
        if (res.code == 200) {
          this.isOrder = false;
          this.getOrderList();
          this.$message({ message: msg, type: "success" });
        } else this.$message({ message: msg, type: "warning" });

        this.getUntreatedData();
      });
    },
    //获取归属人ID!
    belongData(e) {
      this.tbQuickApplyVo.trustee = e;
    },
    handleCloseCheck(done) {
      this.$confirm("确认关闭？")
        .then(() => {
          done();
          this.$refs.CheckDia.formResetFields(true);
        })
        .catch(() => {
        });
    },
    newSingLe() {
      // 录入新单
      let pathUrl = this.$route.path;
      this.$router.push({
        path: "/index/NewSingleEntry",
        query: { path: pathUrl } //记录跳入录入新单进口路径
      });
      sessionStorage.setItem("orderStatus", this.newsOrderStatus);
    },

    // 已录入
    HasBeen(row) {
      let pathUrl = this.$route.path;
      sessionStorage.setItem("orderNumber", row.orderNumber);
      this.$router.push({
        path: "/index/HasBeenRecorded",
        query: { path: pathUrl } //记录跳入录入新单进口路径
      });
    },
    // 审批中
    Examination(row) {
      let pathUrl = this.$route.path;
      sessionStorage.setItem("orderNumber", row.orderNumber);
      this.$router.push({
        path: "/index/Examination",
        query: { path: pathUrl } //记录跳入录入新单进口路径
      });
    },
    // 待交件
    ToSubmit(row) {
      sessionStorage.setItem("orderNumber", row.orderNumber);
      this.$router.push("/index/ToSubmit");
    },
    // 待放款
    ToBeLent(row) {
      sessionStorage.setItem("orderNumber", row.orderNumber);
      this.getTbleadgUrl(row.orderNumber).then((res) => {
        this.$router.push({
          path: res.data.lendingUrl, //待放款
          query: { status: false, orderStatus: row.orderStatus,orderMoney:row.orderMoney  }
        });
      });
    },
    //待跟进
    toFollow(row) {
      let pathUrl = this.$route.path;
      sessionStorage.setItem("orderNumber", row.orderNumber);
      this.$router.push({
        path: "/Index/ToBeFollow",
        query: { path: pathUrl } //记录跳入录入新单进口路径
      });
    },
    // 已终止和已归档
    Terminated(row) {
      sessionStorage.setItem("orderNumber", row.orderNumber);
      this.getTbleadgUrl(row.orderNumber).then((res) => {
        this.$router.push(res.data.pigeonholeUrl);
      });
    },
    // 已放款
    Released(row) {
      sessionStorage.setItem("orderNumber", row.orderNumber);
      //判断点击是否放款
      this.getTbleadgUrl(row.orderNumber).then((res) => {
        this.$router.push(res.data.alreadyUrl);
      });
    },
    //获取未处理数量
    getOrderNumBy() {
      getOrderListBy(this.valQuerryBy).then((res) => {
        this.newNum = res.data.total;
        this.$forceUpdate();
      });
    },
    //获取客户产品所有信息
    getOrderList() {
      this.queryData = JSON.parse(JSON.stringify(this.query));
      getOrderListBy(this.valQuerryBy).then((res) => {
        this.newNum = res.data.total;
      });
      getOrderListBy(this.valQuerry).then((res) => {
        this.tableData = res.data.records;
        this.pagesize = res.data.size;
        this.pageNo = res.data.current;
        this.total = res.data.total;
        this.pages = res.data.pages;
      });
    },
    // 订单状态
    orderStatus() {
      getEmployee("order_state").then((res) => {
        this.orderStatusData = res.data;
      });
    },
    // 人员类型
    personnelType() {
      getEmployee("emp_type").then((res) => {
        this.personnelTypeData = res.data;
      });
    },
    // 是否由我审批
    approvalByMeState() {
      getEmployee("approval_by_me_state").then((res) => {
        this.approvalByMeStateData = res.data;
        for (let i = 0; i < this.approvalByMeStateData.length; i++) {
          this.approvalByMeStateData[i].itemValue = Number(
            this.approvalByMeStateData[i].itemValue
          );
        }
      });
      //财务收费状态chargeStatus
      getEmployee("charge_status").then((res) => {
        this.chargeStatus = res.data;
      });
    },
    // 更新提醒
    markUpdate() {
      getEmployee("mark_update").then((res) => {
        this.markUpdateData = res.data;
      });
    },
    // 提成核算状态
    calculationState() {
      getEmployee("calculation_state").then((res) => {
        this.calculationStateData = res.data;
      });
    },
    // 归属公司
    companylist() {
      pagelist().then((res) => {
        this.companyData = res.data;
      });
    },
    // 通过选中公司id查询部门
    companyChange(val) {
      this.query.firmId = val;
      this.queryPersonnel.firmId = val;
      this.query.deptId = null;
      getDepartment(val).then((res) => {
        this.deptData = res.data;
      });
      this.postCompanyEmployList(this.queryPersonnel);
    },
    // 获取部门id
    handleNodeClick(data) {
      this.query.deptId = data.id;
      this.queryPersonnel.deptId = data.id;
      this.postCompanyEmployList(this.queryPersonnel);
    },
    // 获取归属人员数据
    postCompanyEmployList() {
      postCompanyEmployList(this.queryPersonnel).then((res) => {
        this.personnelData = res.data;
      });
    },
    // 归属人员类型翻译
    translaPersonnel(row) {
      return this.selectDictLabel(this.personnelTypeData, row.belongType);
    },
    // 提成核算状态翻译
    translaCalculation(row) {
      return this.selectDictLabel(
        this.calculationStateData,
        row.calculationState
      );
    },
    // 由我审批翻译
    translaApprovalByMe(row) {
      return this.selectDictLabel(
        this.approvalByMeStateData,
        row.approvalByMeState
      );
    },
    // 更新提醒翻译
    translaMarkUpdate(row) {
      if (row.markUpdate > 0) {
        return "有更新";
      } else {
        return "无更新";
      }
      //return this.selectDictLabel(this.markUpdateData, row.markUpdate);
    },
    // 订单状态翻译
    translaOrderStatus(row) {
      if (row.orderStatus==13 && !row.orderMoney ){
        return '审批中';
      }
      return this.selectDictLabel(this.orderStatusData, row.orderStatus);
    },
    ...mapMutations(["valueQuery"]),
    // 搜索按钮
    queryFun() {
      this.getUserSearch();
      delete this.queryData.grantTime;
      this.valueQuery(this.queryData);
      this.getOrderListBy(this.valQuerry);
      this.currentPage = 1;
      //清空多选
      this.$refs["multipleTable"].clearSelection();
    },
    // 清空按钮
    emptyFun() {
      this.answerMonth = null;
      this.$refs["query"].resetFields();
      this.query.grantTime = null;
      this.query.inputMin = null;
      this.query.inputMax = null;
      (this.deptData = []),
        (this.personnelData = []),
        (this.queryData = JSON.parse(JSON.stringify(this.query)));
      this.queryData.prductId = sessionStorage.getItem("prductId");
      //录入日期
      if (this.queryData.grantTime && this.queryData.grantTime[0]) {
        this.queryData.inputMin = GMTToStr(this.queryData.grantTime[0]);
        this.queryData.inputMax = GMTToStr(this.queryData.grantTime[1]);
      }
      delete this.queryData.grantTime;
      //清空多选
      this.$refs["multipleTable"].clearSelection();
      this.valueQuery(this.queryData);
      this.getOrderListBy(this.queryData);
      this.currentPage = 1;
    },
    // 删除按钮
    suspendFun(row) {
      this.dialogsuspendFun = true;
      this.suspend.orderNumber = row.orderNumber;
      this.suspendInf.name = row.borrowerName;
    },
    //终止按钮
    submitsuspendFun() {
      let that = this;
      this.$refs.suspendForm.validate().then(() => {
        delOrder(that.suspend).then((res) => {
          if (res.code == 200) {
            that.$message({
              message: res.message,
              type: "success"
            });
            that.dialogsuspendFun = false;
            that.getOrderListBy(that.valQuerry);
          } else {
            that.$message({
              message: res.message,
              type: "error"
            });
            that.getOrderListBy(that.valQuerry);
          }
        });
      });
    },
    beforeClose() {
      this.suspend.operationCause = null;
    },
    districtBeforeClose(done) {
      this.$confirm("确认关闭？")
        .then(() => {
          done();
          this.$refs.DistrictRef.DistrictFormFun();
        })
        .catch(() => {
        });
    },
    //分页
    handleCurrentChange(cpage) {
      this.queryData.pageNo = cpage;
      //录入日期
      if (this.queryData.grantTime && this.queryData.grantTime[0]) {
        this.queryData.inputMin = GMTToStr(this.queryData.grantTime[0]);
        this.queryData.inputMax = GMTToStr(this.queryData.grantTime[1]);
      }
      delete this.queryData.grantTime;
      this.valueQuery(this.queryData);
      this.getOrderListBy(this.valQuerry);
    },
    handleSizeChange(psize) {
      this.queryData.pageSize = psize;
      //录入日期
      if (this.queryData.grantTime && this.queryData.grantTime[0]) {
        this.queryData.inputMin = GMTToStr(this.queryData.grantTime[0]);
        this.queryData.inputMax = GMTToStr(this.queryData.grantTime[1]);
      }
      delete this.queryData.grantTime;
      this.valueQuery(this.queryData);
      this.getOrderListBy(this.valQuerry);
    },
    // 批量
    getRowKey(row) {
      return row.orderId;
    },
    changeFun(row) {
      this.ids = row.map((item) => item.orderNumber);
      this.orderExportId = row.map((item) => item.orderId);

      this.multipleSelection = row;
      this.select_order_number = this.multipleSelection.length;
      this.select_orderId = [];
      if (row) {
        row.forEach((row) => {
          if (row) {
            this.select_orderId.push(row.orderNumber);
          }
        });
      }
    },
    //更新状态
    putUpdateStatus(oldStatus, newStatus) {
      let that = this;
      let arr = this.ids;
      let arrList = this.tableData;
      let status = [];
      for (let i = 0; i < arrList.length; i++) {
        for (let j = 0; j < arr.length; j++) {
          if (arrList[i].orderNumber == arr[j]) {
            status.push(arrList[i].orderStatus);
          }
        }
      }
      if (status.length == 0) {
        that.$message({
          message: "请选择一个订单",
          type: "error"
        });
        return;
      }
      for (let i = 0; i < status.length; i++) {
        if (status[i] !== oldStatus) {
          that.$message({
            message: "请选择正确的订单号",
            type: "error"
          });
          return;
        }
      }
      let putArr = [];
      arr.map((item) => {
        putArr.push({ orderNumber: item, statusId: newStatus });
      });
      updateStatusList(putArr).then((res) => {
        that.$message({
          message: res.message,
          type: "success"
        });
        that.getOrderList();
      });
    }
  },
  watch: {
    total: {
      handler() {
        if (
          this.total == (this.pageNo - 1) * this.pagesize &&
          this.total != 0
        ) {
          this.pageNo -= 1;
          this.queryData.pageNo = this.pageNo;
          //录入日期
          if (this.queryData.grantTime && this.queryData.grantTime[0]) {
            this.queryData.inputMin = GMTToStr(this.queryData.grantTime[0]);
            this.queryData.inputMax = GMTToStr(this.queryData.grantTime[1]);
          }
          delete this.queryData.grantTime;
          this.valueQuery(this.queryData);
          this.getOrderListBy(this.valQuerry); //获取列表数据
        }
      }
    },
    $route: function(to, from) {
      if (to.path != from.path) {
        // this.queryData.prductId = sessionStorage.getItem("prductId");
        // this.queryData.pageNo = 1;
        // this.valueQuery(this.queryData);
        // this.getOrderListBy(this.queryData);
        this.emptyFun();
        this.valQuerryBy.prductId = sessionStorage.getItem("prductId");
        this.query.prductId = sessionStorage.getItem("prductId");
        this.getProduct();
        this.getOrderNumBy();
        this.currentPage = 1;
      }
    }
  }
};
</script>

<style scoped type="less">
.query .el-form-item {
  position: relative;
  box-sizing: border-box;
  width: 320px;
  padding-left: 110px;
}

.query ::v-deep .el-form-item__label {
  line-height: 32px;
  position: absolute;
  top: 0;
  left: 0;
  width: 110px;
  height: 32px;
  text-align: right;
}

.query ::v-deep .vue-treeselect {
  height: 32px;
}

.query ::v-deep.el-input__icon,
.query ::v-deep.el-range-separator {
  line-height: 24px;
}

.treeSel ::v-deep .vue-treeselect__control {
  line-height: 30px;
  overflow: hidden;
  height: 32px;
}

::v-deep .el-table td {
  padding: 10px 0;
}

::v-deep .el-table th {
  padding: 10px 0;
}

::v-deep .el-button--text {
  /* width: 40px; */
}

::v-deep .el-form--inline .el-form-item__content {
  line-height: 32px;
  width: 100%;
}

::v-deep .btn .el-form-item__content {
  width: 100%;
}

.query ::v-deep .el-input__inner {
  line-height: 32px;
  height: 32px;
}

::v-deep .el-input__icon {
  line-height: 32px;
}

.query .el-select {
  width: 100%;
}

::v-deep .button .el-button {
  line-height: 0;
  width: 80px;
  height: 32px;
}

::v-deep .el-table th > .cell {
  font-size: 14px;
  font-weight: bold;
  color: #333;
}

::v-deep .el-table--striped .el-table__body tr.el-table__row--striped td {
  background: rgba(59, 157, 248, 0.1);
}

.main {
  position: relative;
}

::v-deep .el-pagination {
  position: absolute;
  right: 0;
  margin-top: 20px;
}

::v-deep .el-pagination__total {
  visibility: hidden;
}

.title {
  font-family: Microsoft YaHei;
  font-size: 12px;
  font-weight: 400;
  line-height: 21px;
  position: absolute;
  top: 20px;
  left: 0;
  color: rgba(51, 51, 51, 1);
}

.btn .el-button {
  float: left;
}

.wrap_te {
  padding: 15px 10px 0 0;
}

.wrap_te .el-form-item {
  margin-bottom: 10px;
}

.el-form-item.button {
  width: 100%;
  text-align: right;
}

.el-table ::v-deep.tips .cell {
  overflow: visible;
}

.el-table ::v-deep.tips sup {
  top: -4px;
  right: 11px;
}
</style>
